//
//  HomeHeaderView.m
//  CFfuturestalent
//
//  Created by 子yu 刘 on 2018/4/24.
//  Copyright © 2018年 子yu 刘. All rights reserved.
//

#import "HomeHeaderView.h"

@implementation HomeHeaderView

-(instancetype)init{
    if (self = [super init]) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI{
    self.backgroundColor = DEF_COLOR_HOMETABBGCOLOR;
    self.icon = [[UIImageView alloc] init];
    [self addSubview:self.icon];
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(self.mas_centerY);
    }];
    self.title = [[UILabel alloc] init];
    [self addSubview:self.title];
    self.title.textColor = [UIColor whiteColor];
    self.title.font = [UIFont systemFontOfSize:15];
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.mas_equalTo(self.icon.mas_right).mas_offset(10);
    }];
    UIImageView * imgRight = [[UIImageView alloc] init];
    imgRight.image = [UIImage imageNamed:@"home_right"];
    [self addSubview:imgRight];
    [imgRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.mas_equalTo(-15);
    }];
    UIView * line = [[UIView alloc] init];
    line.backgroundColor = DEF_COLOR_HOMETABLINECOLOR;
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.right.equalTo(self);
        make.bottom.equalTo(self);
        make.height.mas_equalTo(0.5);
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    if (self.clickedBlock) {
        self.clickedBlock();
    }
}
@end
